#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int* findErrorNums(int* nums, int numsSize) {
    static int arr[2] = { 0 };
    int *temp=(int*)malloc(sizeof(int)*numsSize);
    int i = 0;
    for (i = 0; i < numsSize; i++)
    {
        temp[i] = 0;
    }
    for (i = 0; i < numsSize; i++)
    {
        temp[nums[i] - 1]++;
    }
    for (i = 0; i < numsSize; i++)
    {
        if (temp[i] == 2)
        {
            arr[0] = i + 1;
        }
        if (temp[i] == 0)
        {
            arr[1] = i + 1;
        }
    }
    return arr;
}

int main()
{
    int len = 0;
    scanf("%d", &len);
    int* nums = (int*)malloc(sizeof(int) * len);
    int* ret;
    for (int i = 0; i < len; i++)
    {
        scanf("%d", &nums[i]);
    }
    ret = findErrorNums(nums, len);
    free(nums);
    printf("%d %d", ret[0], ret[1]);
    return 0;
}